var pageCount = 1;
function classOnload(a){
    console.log(a);

var Json={
    pageIndex:1,
    pageSize:10,
    userRole:0//0管理1老师2学生

}
ajax.post(ajax.myUrl+"relax/checkList",Json,function(result){
    console.log(result);
    response(result);
    console.log(result.dataset.realaxVo);
    var data = result.dataset.realaxVo;
    var tbody = document.querySelector("tbody");
    for(var i=0;i<data.length;i++){
        var newtr = document.createElement("tr");
        newtr.innerHTML=`
        <td>${data[i].userName}</td>
         <td>${data[i].relaxReason}</td>
         <td>${data[i].relaxPri}</td>
         <td>${data[i].relaxDate}</td>
        
         <td> <div class="pass">通过</div>
         <div class="nopass">不通过</div></td>
         
         `;
         tbody.appendChild(newtr)
        
    }
    var ok = document.querySelectorAll(".pass");
    // console.log(ok);
    for(var i=0;i<ok.length;i++){
        ok[i].addEventListener("click",function(){
            for(var j=0;j<ok.length;j++){
                if(this==ok[j]){
                    // console.log(data[j].relaxId)
                    var Json2={
                        relaxId:data[j].relaxId,
                        status:2

                    }
                    console.log(Json2)
                    ajax.post(ajax.myUrl+"relax/agreeCheck",Json2,function(result){
                    
                    })
                }
            }
        })
    }
    var no = document.getElementsByClassName("nopass");
    console.log(no);
    for(var k=0;k<no.length;k++){
        no[k].onclick=function(){
            for(var l=0;l<no.length;l++){
                if(this==no[l]){
                    var Json3={
                        relaxId:data[l].relaxId,
                        status:1
                    }
                    console.log(Json3)
                    ajax.post(ajax.myUrl+"relax/agreeCheck",Json3,function(result){
                    
                    })
                }
            }
        }
    }
}) 
}